﻿using Native.Sdk.Cqp.EventArgs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Code
{
    public class Event_PoolInfo : IMessageEvent
    {
        public string Message => "查看卡池信息";

        public void Process(CQPrivateMessageEventArgs e)
        {
            //throw new NotImplementedException();
        }

        public void Process(CQGroupMessageEventArgs e)
        {
            //throw new NotImplementedException();
            StringBuilder sb = new StringBuilder();
            sb.AppendLine($"{e.FromQQ.CQCode_At()}目前所有卡池信息如下:");
            foreach (var item in AppMain.Pools)
            {
                int sum = item.LevelCollections.Sum((HeerCards.HCLevel level)=>level.Ratio);
                sb.AppendLine($"卡池：{item.PoolName}");
                item.LevelCollections.ForEach((HeerCards.HCLevel level) => { 
                    sb.AppendLine($" 等级【{level.Name}】：{level.Cards.Count}张卡");
                    sb.AppendLine($" 预计概率：{(float)level.Ratio / sum*100}%");
                });
            }
            e.FromGroup.SendGroupMessage(sb.ToString());
        }
    }
}
